﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
#region Version Info
/* ========================================================================
* 【本页面功能概述】
*
* 作者：wangjianfeng 创建时间：2012/9/15 15:50:02
* 文件名：FriendLink.cs
*
* 修改者： 时间：
* 修改说明：
* ========================================================================
*/
#endregion
namespace ChinaLeg.Cache
{
    public class FriendLink
    {
        #region 类实例化单件模式
        static FriendLink instance = null;
        static readonly object padlock = new object();

        public static FriendLink Instance
        {
            get
            {
                if (instance == null)
                {
                    lock (padlock)
                    {
                        if (instance == null)
                        {
                            instance = new FriendLink();
                        }
                    }
                }
                return instance;
            }
        }
        #endregion
        /// <summary>
        /// 获取友情链接列表
        /// </summary>
        /// <returns></returns>
        public List<ChinaLeg.Model.FriendLink> GetList()
        {
            string key = ChinaLeg.Cache.CacheKeys.Keys["FriendLinks"];
            if (System.Web.HttpContext.Current.Cache[key] == null)
            {
                List<ChinaLeg.Model.FriendLink> list = ChinaLeg.BLL.FriendLink.Instance.GetList();
                System.Web.HttpContext.Current.Cache.Insert(key, list, null, DateTime.Now.AddDays(1), TimeSpan.Zero);
                return list;
            }
            else
            {
                return System.Web.HttpContext.Current.Cache[key] as List<ChinaLeg.Model.FriendLink>;
            }

        }
    }
}
